package com.jg.comm;

import lombok.Data;

import java.util.List;

/**
 * @author 86130
 * @version 1.0
 * @description: TODO
 * @date 2025/9/2 下午3:32
 */
@Data
public class Page<T> {
    //当前页码
    private Integer pageNum=1;
    //每页显示的记录数
    private Integer pageSize=2;
    //总记录数
    private Integer totalCount;
    //总页数
    private Integer totalPage;
    //数据集合
    private List<T> data;

    //总页数
    public void setTotalCount(Integer totalCount){
        if (totalCount > 0){
            this.totalCount = totalCount;
            this.totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
        }
    }
}
